import request from '@/utils/request'
import { AxiosPromise } from 'axios'

enum Api {
  list = '/mapConfig/list',
  available = '/mapConfig/available',
  changeStatus = '/mapConfig/changeStatus',
  changeProperties = '/mapConfig/changeProperties',
}

export const mapList = (data: any): AxiosPromise<any> => {
  return request({
    url: Api.list,
    method: 'post',
    data,
  })
}

export const mapAvailable = (data: any): AxiosPromise<any> => {
  return request({
    url: Api.available,
    method: 'post',
    data,
  })
}

export const changeProperties = (data: any) => {
  return request({
    url: Api.changeProperties,
    method: 'post',
    data,
  })
}

// 状态修改
export function changeStatus(id: string | number, status: number) {
  const data = {
    id,
    status,
  }
  return request({
    url: Api.changeStatus,
    method: 'post',
    data,
  })
}
